import request from "@/utils/request"

/**
 * 获取商品详情
 * @param {String} id - 商品ID
 */
export const findGoods = (submitData) => {
  return request({
    url: '/goods',
    method: 'get',
    submitData
  })
}


// 获取<猜你喜欢 || 同类推荐>
export const findRelGoods = (id) => {
  return request({
    url: '/goods/relevant',
    method: 'get',
    submitData: {
      id,
      limit: 16
    }
  })
}

/**
 * 获取热榜商品
 * @param {Number} type - 1代表24小时热销榜 2代表周热销榜 3代表总热销榜
 * @param {Number} limit - 获取个数
 */

export const findHotGoods = ({ id, type, limit = 3 }) => {
  return request({
    url: '/goods/hot',
    method: 'get',
    submitData: {
      id,
      type,
      limit
    }
  })
}